package day03;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class loginServlet extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		if(req.getParameter("username").equals("admin")&&req.getParameter("password").equals("admin"))	{
//			req.getRequestDispatcher("success.jsp").forward(req, resp);
			resp.sendRedirect("success.jsp");
		}else {
			req.setAttribute("error","用户名密码错误");
			req.getRequestDispatcher("login.jsp").forward(req, resp);
		}
		
	}
}
